As a kind of electrically programmable non-volatile semiconductor memory, EEPROM (electrically erasable and programmable read only memory) and flash-type EEPROM are known.
FIG. 1 is a schematic sectional view showing a typical flash-type EEPROM. Referring to FIG. 1, a drain 101 and a source 102, both of which are of n-type impurity diffusion layer, are formed on the surface of a p-type silicon substrate 100, and a channel region 103 is defined therebetween. Also, a tunnel insulating film 104 of SiO.sub.2 is formed on the channel region 103, and a floating gate 105, an interlayer insulating film 106 and a control gate 107 are formed thereon in this order. 108 is a bit line connected to the drain 101, and 109 is a source line.
In the write operation of a memory cell composed as above-mentioned, for example, the substrate 100 is grounded and voltages of 12V, 5V and 0V are applied to the control gate, drain 101 and source, respectively.
At this time, the potential of the floating gate 105 is increased due to the capacity coupling between the control gate 107 and the floating gate 105, and a channel is formed between the drain 101 and the source 102. High-energy electrons (hot electrons) generate around the drain 101 due to a high voltage of the control gate 107 and a voltage of the drain 101 and they are injected into the floating gate 105 beyond a potential barrier, e.g., 3.2 eV for electron, between the p-type silicon substrate 100 and the tunnel insulating film 104.
The electrons thus injected remain to be held therein even after turning the drain 101 and control gate 107 into open state because the floating gate is surrounded by oxide film with a low conductivity.
On the other hand, in the erase operation, for example, the control gate 107 is grounded and a voltage of 12V is applied to the source 102. Thereby, electrons are extracted from the floating gate 105 to reduce the threshold voltage. In this case, two states of threshold voltages are provided in the memory cell.
In writing binary data (data "0", "1" provided in one memory cell) in a memory cell, the collation judgement, i.e., judging whether the state of a memory cell (data "0" or "1") and write data are identical or not identical with each other, is conventionally conducted by using such a circuit as shown in FIG. 2. Referring to FIG. 2, the circuit comprises a NAND gate 7 that a signal fixed to a `H` level in write operation and a write data signal are input, a NAND gate 8 that the output signal 3 of sense amplifier and the output signal 4 of the NAND gate 7 are input, and an exclusive-NOR (XNOR) gate 9. The output of the XNOR gate 9 is used as an output 6 of collation judgement result.
Referring to FIG. 3 that shows a threshold-voltage distribution for one bit, i.e., one binary data and FIG. 4 that is a flow chart showing a write operation flow, the operation of the conventional collation judgement circuit in FIG. 2 will be explained below. In FIG. 3 the axis of ordinates indicates a threshold voltage of memory cell and the axis of abscissas indicates a bit number with its threshold voltage. Here, an erase state (threshold voltage in memory cell is low) is defined by data "1", and a state that threshold voltage is raised is defined by data "0". "ref" is a reference voltage for judging which the threshold voltage in memory cell is "1" or "0". Which a memory cell selected has a threshold voltage of "1" or "0" is acknowledged by judging that it is higher or lower than the reference voltage.
Referring to FIG. 4, in write operation, for a selected memory cell, a sense amplifier outputs which a pre-write data (data before writing) in memory cell is data "0" (threshold voltage is high) or data "1" (threshold voltage is low) by comparing the memory cell with the reference. Then, a pre-write verifying for comparing with a write data is conducted (step S1). If the pre-write data is identical with the write data (refer to a branch "PASS" in step S1), then the collation judgement circuit outputs "H" (PASS). then proceeding to the write operation of the next address or to the next operation (step S6)
If the pre-write data is not identical with the write data in the write verifying, then outputting "L" (FAIL) as the collation judgement result, applying a write voltage to the selected memory cell (step S2) to raise the threshold voltage, comparing the memory cell after the write voltage application with the reference, outputting which it is data "0" or data "1", then conducting a post-write verifying for comparing with the write data (step S3). If "PASS", then proceeding to the write operation of the next address or to the next operation (step S6). on the other hand, if "FAIL", then judging whether the retrying number (circuit to be applied of write voltage) is "MAX" (maximum value) or not (step S4). If not "MAX" (a branch "NO" in step S4), returning to step S2, again applying the write voltage, conducting the post-write verifying. These steps are repeated until being judged as "PASS".
On the other hand, if the retrying number is "MAX" in step S4, then being regarded as a write error, ending the write operation (step S5).
In general, manufacturers ship products that all memory cells are erased, and its user operates to write a desired pattern in the memory cells. In writing a different pattern therein. the user operates to erase all the memory cells and then to write the different pattern. However, a user may need to write a different pattern adding to a written pattern of product (this operation is hereinafter referred to as `over-write`).
The over-write operation will be explained referring to FIG. 4. First, for a selected memory cell, a pre-write verifying is conducted. If not identical, then outputting "L" (FAIL) as the collation judgement result, and, if identical, then outputting "H" (PASS) as the collation judgement result. Also, if identical, the operation is ended without applying the write voltage to the memory cell.
If not identical, then applying the write voltage to the selected memory cell. conducting the post-write verifying, ending the operation when judged as "PASS".
When the judgement is "FAIL", again applying the write voltage, conducting the post-write verifying. These steps are repeated until the retrying number is "MAX".
FIG. 5 shows a judgement table used in the above-mentioned collation judgement. Referring to FIG. 5, when write data "1" is to be written in a memory cell with a pre-write data "0" that means a high threshold voltage, it is judged as "PASS". The reason is as follows: To turn a memory cell with data "0" into data "1", there is only one way that a block including the selected memory cell is erased to turn all the memory cells in the block into data "1". But, when such an erasing is conducted, all other written data in the memory cells must be changed in to data "1". As compared with a semiconductor storage that can write/erase each one memory cell, a non-volatile semiconductor storage is generally designed so that an erasing is conducted to a certain block e.g., 128 kbite, while a writing can be conducted to each one memory cell. Because of this, when data "1" is to be written in, the state of a memory cell before writing is not changed. Thus, when data "1 " is to be written in a memory cell with pre-write data "0", the data in the memory cell needs to be kept "0".
The operation of the circuit in FIG. 2 will be explained below.
A signal 1 is fixed to "H" when the write operation (from pre-write verifying until post-write verifying) is started. As a write data signal 2, "L" is input when data "0" is to be written in and "H" is input when data "1" is to be written in (when the state of a memory cell is desired to keep, i.e., not to conduct the writing). A sense amplifier signal 3 is a signal that is output detecting the state of a memory cell before writing by a sense amplifier. For example, it is "L" for a memory cell with data "1" and it is "H" for a memory cell with data "0". The signal flow until the output 6 of collation judgement result is as follows: When a write data is "0", the write data signal 2 is "H". Then, the output 4 of the NAND circuit 7 is "L", the output 5 of the NAND circuit 8 is "H", and the output of the XNOR circuit 9, i.e., the output 6 of the collation judgment result, is "H" (PASS) regardless of the output signal of the sense amplifier.
Next, when data "0" is to be written in a memory cell with pre-write data "0", the write data signal 2 is "L". Then, the output 4 of the NAND circuit 7 is "H", the output signal 3 of the sense amplifier is "H" for pre-write data "0", the output 5 of the NAND circuit 8 is "L", and the output 6 of the collation judgement result is "H" (PASS).
Finally, when data "0" is to be written in a memory cell with pre-write data "1", the write data signal 2 is "L". Then, the output 4 of the NAND circuit 7 is "H", the output signal 3 of the sense amplifier is "L" for pre-write data "1", the output 5 of the NAND circuit 8 is "H", and the output 6 of the collation judgement result is "L" (FAIL).
In this case, the write operation is proceeded to applying the write voltage to the selected memory cell, thereby raising the threshold voltage. Then, again conducting the collation judgement, when the output signal 3 becomes "H", by that the memory cell has a threshold voltage to data "0", the output 5 of the NAND circuit 8 is "L". Thereby, the output 6 of the collation judgement result becomes "H" (PASS).
As described above, in the collation judgement circuit in FIG. 2, when data "1" is to be written in a memory cell with pre-write data "0", the collation judgement result is output as "H" (PASS).
FIG. 6 shows another collation judgement circuit and FIG. 7 shows a judgement table used in this collation judgement circuit. Referring to FIG. 6. the circuit comprises a NAND gate 65 that a signal 60 fixed to "H" level in write operation and a write data signal 61 are input, and an exclusive-NOR (XNOR) circuit 66 that the output signal 62 of a sense amplifier and the output signal 63 of the NAND gate 65 are input. The output of the XNOR circuit 66 is used as an output 64 of collation judgement result.
In the circuit in FIG. 6, the write operation conducted when data "0" is to be written in a memory cell with pre-write data "0" and when data "0" or "1" is to be written in a memory cell with pre-write data "1" is similar to that of the circuit in FIG. 2. The explanation is therefore omitted.
On the other hand, as described earlier, data "1" cannot be written in a memory cell with pre-write data "0". In this case, it is processed as write error.
As explained above, the two types of collation judgement circuits that process such a case as write error and "PASS", respectively are known.
Recently, to realize a large-capacity semiconductor storage, it is proposed that several-bit data is assigned to one memory cell. In such a case, the memory cell needs to have several kinds of threshold-voltage states. For example, a case that two-bit data (quaternary data) is assigned to one memory cell will be explained below.
FIG. 8 shows a threshold-voltage distribution for ternary data. In FIG. 8, the axis of ordinates indicates a threshold voltage of memory cell and the axis of abscissas indicates a bit number with its threshold voltage. Here, an erase state (threshold voltage in memory cell is lowest) is defined by data "11", and states that threshold voltages are raised stepwise are defined by data "10", "01" and "00", whose threshold voltage is highest. "ref.1, 2 and 3" are reference voltages for judging which state the threshold voltage in memory cell belongs to. Which state of the four threshold-voltage states a memory cell selected belongs to is acknowledged by judging that its voltage is higher or lower than the different reference voltages.
The over-write operation of quaternary data by using the conventional circuit in FIG. 2 in the conventional manner that the collation judgment result is output as "PASS" when data "1" is to be written in a memory cell with pre-write data "0" will be explained below. FIG. 9 shows a judgement table used in the collation judgement.
The right-hand bit of data "11", "10", "01" or "00" is called `low-order bit` and the left-hand bit thereof is called `high-order bit`.
First, when data "11" is to be written, the collation judgement result is output as "H" (PASS) regardless of a pre-write data in pre-write verifying because pre-write data is to be kept unalteredly like the conventional manner.
Second, when data "10" is to be written in a memory cell with pre-write data "00", for the low-order bit that data "0" is to be written in data "0", the collation judgement result is "PASS", and, for the high-order bit that data "1" is to be written in data "0", the collation judgement result is "PASS". Thus, the pre-write verifying is ended outputting "PASS". Also, data "01" is processed in like manner.
Third, when data "10", "01" and "00" are to be written in a memory cell with pre-write data "10", "01" and "00", respectively, the pre-write verifying is ended outputting "PASS" because the high-order bit and low-order bit are identical with each other.
Fourth, when data "10", "01" and "00" are to be written in a memory cell with pre-write data "11", the pre-write verifying outputs "FAIL", then applying a write voltage to the memory cell to raise stepwise the threshold voltage, conducting the post-write verifying. When the threshold-voltage state corresponding to the respective write data in FIG. 8 is obtained by repeating these steps, the collation judgement result is ended outputting "PASS" (H).
Fifth, when data "00" is to be written in a memory cell with pre-write data "10" and "01", for the low-order bit or high-order bit, the pre-write verifying outputs "FAIL", then applying a write voltage to the memory cell to raise stepwise the threshold voltage, conducting the post-write verifying. When the threshold-voltage state corresponding to data "00" is obtained by repeating these steps, the collation judgement result is ended outputting "PASS" (H).
Sixth, when data "10" is to be written in a memory cell with pre-write data "01", for the low-order bit, the pre-write verifying outputs "FAIL", then applying a write voltage to the memory cell to raise stepwise the threshold voltage, conducting the post-write verifying. When the threshold-voltage state corresponding to data "00" is obtained by repeating these steps, the collation judgement result is ended outputting "PASS" (H).
Here, regarding the high-order bit, when "1" is to be written for pre-write data "0", the post-write data is allowed to be "0". Regarding the low-order bit, when "0" is to be written for pre-write data "1", the post-write data needs to be unalteredly "0". Thus, when "10" is to be written for pre-write data "01", the post-write needs to be "00". As a result, the writing can be conducted to be identical with the expected value.
Seventh, when data "01" is to be written in a memory cell with pre-write data "10", for the high-order bit, the pre-write verifying outputs "FAIL", then applying a write voltage to the memory cell to raise stepwise the threshold voltage, conducting the post-write verifying. Repeating these steps, when the threshold voltage of the memory cell is raised to a threshold voltage for data "01", the output signal 3 of sense amplifier of the collation judgement circuit in FIG. 2 outputs to be identical with the write data "01" according to the threshold-voltage relation in FIG. 8. Thereby, the output 6 of the collation judgement result is turned into "PASS". As a result, the post-write data becomes "01".
Here, in writing data "01" in a memory cell with pre-write data "10", regarding the high-order bit, when "0" is to be written for pre-write data "1", the post-write data becomes "0". As a result, the data are identical with each other. On the other hand, regarding the low-order bit, when "1" is to be written for pre-write data "0", the post-write data needs to be unalteredly "0". Thus, the post-write must be "00". However, in the collation judgement circuit in FIG. 2, the output 6 of collation judgement result must be output as "H" (PASS) at a threshold voltage for data "01" and the writing is then ended.
Thus, there is a problem that a compatibility with binary data cannot be obtained.
Meanwhile, in the conventional collation judgement circuit in FIG. 6 that a write error is issued when data "1" is to be written in a memory cell with pre-write data "0", a write error is issued when the pre-write data and write data are not identical with each other. Therefore, such a problem does not occur.